// Programming_Scala/src/ch12/infix-types-script.scala

def infixAttempt( operation: => Boolean ): Throwable Either Boolean = try {
  Right( operation )
} catch {
  case t: Throwable => Left( t )
}

def postfixAttempt( operation: => Boolean ): Either[ Throwable, Boolean ] = try {
  Right( operation )
} catch {
  case t: Throwable => Left( t )
}

println( infixAttempt { throw new RuntimeException( "Boo!" ) } )
println( postfixAttempt { throw new RuntimeException( "Boo!" ) } )
println( infixAttempt { true } )
println( postfixAttempt { true } )
println( infixAttempt { false } )
println( postfixAttempt { false } )

